﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using My.Common.AutoMapper;
using WarehouseManagement.ViewModels;

namespace WarehouseManagement.Presenters
{
    public abstract class BasePresenter<ViewModel> where ViewModel : IBaseViewModel
    {
        protected object _view;

        protected ViewModel Model
        {
            get { return (ViewModel)_view; }
        }
        protected BasePresenter() { }

        public virtual void RegisterViewModel(ViewModel viewModel)
        {
            _view = viewModel;
            WireupEventHandles();
        }
        protected abstract void WireupEventHandles();

        protected My.Common.AutoMapper.AutoMapperBuilder ObjectMapper
        {
            get
            {
                AutoMapperBuilder mapper = new AutoMapperBuilder();
                return mapper;
            }
        }

    }
}
